﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel;
using System.Web.Script.Serialization;
using System.ServiceModel.Web;
using Microsoft.SqlServer.Management.Smo;
using System.Configuration;
using System.Data.SqlClient;
using Microsoft.SqlServer.Management.Common;

namespace Moddb08_WCF
{

    [ServiceContract]
    public class Backend
    {
        Database db;
        Server dbServer;
        public Backend()
        {
            string connectionString = ConfigurationManager.ConnectionStrings["moddbConnectionString"].ConnectionString;
            SqlConnection sqlConnection = new SqlConnection(connectionString);
            dbServer = new Server (new ServerConnection(sqlConnection));
            db = new Database(dbServer, "moddb");

        }

        [OperationContract]
        [WebGet(UriTemplate = "Tables/")]
        Tables GetAllTables()
        {
            //TODO: Get the real table names
            Tables tables = new Tables();
            return tables;
        }
    }
}
